// 嫌疑程度枚举
export enum SuspicionLevel {
  HIGH = 'HIGH',    // 高度怀疑
  MEDIUM = 'MEDIUM', // 中度怀疑
  LOW = 'LOW'       // 低度怀疑
}

// 性别枚举
export enum Gender {
  MALE = 'MALE',     // 男性
  FEMALE = 'FEMALE',  // 女性
  OTHER = 'OTHER'     // 其他
}

// 嫌疑人实体类
export class SuspectModel {
  private id: string;            // 嫌疑人ID
  private caseId: string;        // 关联的案件ID
  private name: string;          // 嫌疑人姓名
  private age: number;           // 年龄
  private gender: Gender;        // 性别
  private occupation: string;    // 职业
  private suspicionLevel: SuspicionLevel; // 嫌疑程度
  private description: string;   // 描述
  private lastSeenLocation: string; // 最后出现地点
  private lastSeenTime: string;  // 最后出现时间
  
  constructor(
    id: string = '',
    caseId: string = '',
    name: string = '',
    age: number = 0,
    gender: Gender = Gender.MALE,
    occupation: string = '',
    suspicionLevel: SuspicionLevel = SuspicionLevel.MEDIUM,
    description: string = '',
    lastSeenLocation: string = '',
    lastSeenTime: string = new Date().toISOString()
  ) {
    this.id = id;
    this.caseId = caseId;
    this.name = name;
    this.age = age;
    this.gender = gender;
    this.occupation = occupation;
    this.suspicionLevel = suspicionLevel;
    this.description = description;
    this.lastSeenLocation = lastSeenLocation;
    this.lastSeenTime = lastSeenTime;
  }
  
  // Getters
  public getId(): string {
    return this.id;
  }
  
  public getCaseId(): string {
    return this.caseId;
  }
  
  public getName(): string {
    return this.name;
  }
  
  public getAge(): number {
    return this.age;
  }
  
  public getGender(): Gender {
    return this.gender;
  }
  
  public getOccupation(): string {
    return this.occupation;
  }
  
  public getSuspicionLevel(): SuspicionLevel {
    return this.suspicionLevel;
  }
  
  public getDescription(): string {
    return this.description;
  }
  
  public getLastSeenLocation(): string {
    return this.lastSeenLocation;
  }
  
  public getLastSeenTime(): string {
    return this.lastSeenTime;
  }
  
  // Setters
  public setId(id: string): void {
    this.id = id;
  }
  
  public setCaseId(caseId: string): void {
    this.caseId = caseId;
  }
  
  public setName(name: string): void {
    this.name = name;
  }
  
  public setAge(age: number): void {
    this.age = age;
  }
  
  public setGender(gender: Gender): void {
    this.gender = gender;
  }
  
  public setOccupation(occupation: string): void {
    this.occupation = occupation;
  }
  
  public setSuspicionLevel(suspicionLevel: SuspicionLevel): void {
    this.suspicionLevel = suspicionLevel;
  }
  
  public setDescription(description: string): void {
    this.description = description;
  }
  
  public setLastSeenLocation(location: string): void {
    this.lastSeenLocation = location;
  }
  
  public setLastSeenTime(time: string): void {
    this.lastSeenTime = time;
  }
  
  /**
   * 从JSON对象创建SuspectModel实例
   * @param json JSON对象
   * @returns SuspectModel实例
   */
  public static fromJson(json: any): SuspectModel {
    return new SuspectModel(
      json.id || '',
      json.caseId || '',
      json.name || '',
      json.age || 0,
      json.gender || Gender.MALE,
      json.occupation || '',
      json.suspicionLevel || SuspicionLevel.MEDIUM,
      json.description || '',
      json.lastSeenLocation || '',
      json.lastSeenTime || new Date().toISOString()
    );
  }
  
  /**
   * 转换为JSON对象
   * @returns JSON对象
   */
  public toJson(): any {
    return {
      id: this.id,
      caseId: this.caseId,
      name: this.name,
      age: this.age,
      gender: this.gender,
      occupation: this.occupation,
      suspicionLevel: this.suspicionLevel,
      description: this.description,
      lastSeenLocation: this.lastSeenLocation,
      lastSeenTime: this.lastSeenTime
    };
  }
  
  /**
   * 生成唯一ID
   * @returns 唯一ID字符串
   */
  public static generateId(): string {
    return Date.now().toString() + Math.random().toString(36).substr(2, 9);
  }
}